package com.company.cloud.company.modules.api.fallback;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.company.modules.api.request.ThirdPlatformConfigGetRequest;
import com.company.cloud.company.modules.api.request.ThirdPlatformValidateContentRequest;
import com.company.cloud.company.modules.api.response.*;
import com.company.cloud.company.modules.api.service.CompanyConfigRemoteService;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class CompanyConfigRemoteServiceFallbackFactory implements FallbackFactory<CompanyConfigRemoteService> {
    @Override
    public CompanyConfigRemoteService create(Throwable cause) {
        return new CompanyConfigRemoteService() {
            @Override
            public BaseClientResult<BaseProfitConfigResp> getBaseProfitConfig(String companyNo) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<CashConfigResp> getCashConfig(String companyNo) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<CustomerRewardResp> getCustomerReward(String companyNo) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<ThirdPlatformConfigModel> getThirdPlatformConfig(ThirdPlatformConfigGetRequest params) {
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<String> getThirdPlatformAccessToken(ThirdPlatformConfigGetRequest params) {
                log.debug("+++++ Fallback Error,CompanyConfigRemoteService.getThirdPlatformAccessToken() !!!");
                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<ValidateContentResp> validateContent(ThirdPlatformValidateContentRequest params) {
                log.debug("+++++ Fallback Error,CompanyConfigRemoteService.validateContent() !!!");
                return BaseClientResult.callbackError();
            }
        };
    }
}
